package com.exercise.ThreadCreate.Method2;

import java.sql.SQLOutput;

public class MyRunnable implements  Runnable{
    @Override
    public void run() {
        System.out.println("MyRunnable running:"+Thread.currentThread().getName());
    }

    public static void main(String[] args) {
        //适合资源共享
        MyRunnable myRunnable = new MyRunnable();
        Thread thread1 = new Thread(myRunnable, "线程A");
        //可以指定线程名
        Thread thread2 = new Thread(myRunnable);
        thread1.start();
        thread2.start();
    }
}
